﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 普通策略模式
{
    /// <summary>
    /// 策略上下文
    /// </summary>
    internal class StrategyContext:IStrategyContext
    {
        IStrategy strategy = null;

        internal StrategyContext(Role role)
        {
            if (role == Role.Vip)
                this.strategy = new StrategyVip();
            else
                this.strategy = new StrategyCommon();
        }

        public double CalculatePrice(IOrder order)
        {
            return strategy.CalculatePrice(order);
        }
    }
}
